<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<h2 class="base-title">重设密码</h2>

<form class="forget-pwd" action="/homepage/reset_pwd" method="post" id="reset_pwd_form">
    <label class="label fix">
        <span class="span">请输入注册所用的邮箱</span>
        <input type="text" name="email" id="e_mail" value="" placeholder="请输入你的电子邮箱" class="mail">
    </label>
    <input type="button" id="reset_pwd_btn" value="确认提交" class="submit">
</form>

<script>
    $(function(){
        var mail_obj = $("#e_mail");
        mail_obj.blur(function(){
            check_value();
        });

        $("#reset_pwd_btn").click(function(){
            if(!check_value()){
                layer.msg('邮箱不能为空');
            }
            var url = '/homepage/check_user_email/'+mail_obj.val();
            $.get(url,function(data){
                var obj = JSON.parse(data);
                if(obj.status == 1)
                {
                    layer.msg(obj.msg);
                    return false;
                }else{
                    $("#reset_pwd_form").submit();
                }
            })
        });

        function check_value(){
            var mail_val = mail_obj.val();
            if(mail_val == ""){
                layer.msg('邮箱不能为空');
                return false;
            }
            return true;
        }
    })

</script>


<{include file="www/footer.tpl"}>

